package com.qst.crop.service;

import com.github.pagehelper.PageInfo;
import com.qst.crop.entity.Order;
import com.qst.crop.entity.OrderDeleteParams;
import com.qst.crop.entity.OrderDiscuss;
import com.qst.crop.entity.SellPurchase;
import io.swagger.models.auth.In;

import java.util.List;

/**
 * @author spengda
 * @date 2024/3/815:17
 */
public interface OrderService {


    PageInfo<Order> findAll(Integer pageNum);

    List<SellPurchase> findAllSells(String username);


    Order getById(Integer orderId);
    /**
     * id查询需求
     * @param id
     * @return
     */
    PageInfo<Order> selectById(Integer id);
    Order selectById(int id);



    /**
     * 查询全部需求
     * @return
     */
    PageInfo<Order> findAllNeeds(Integer pageNum);

    /**
     * 关键词查询需求
     * @param keys
     * @return
     */
    PageInfo<Order> searchNeedsByKeys(String keys,Integer pageNum);


    PageInfo<Order> search(String username,Integer pageNum,String type);
    PageInfo<Order> searchAll(Integer pageNum,String type);

    PageInfo<Order> searchMyGoodsByKeys(Integer pageNum,String title);

    int updateGoods(Order order);

    int insert(Order order);

    PageInfo<Order> findAll(Integer pageNum,String username);

    int insertSelective(Order record);
    Order selectByPrimaryKey(Integer orderId);
    int updateByPrimaryKeySelective(Order record);
    int updateByPrimaryKey(Order record);
    Order selectBuyByUserName(String username);
    Order selectSellByUserName(String username);
    Order selectOrderByUsernameAndType(String username, String type);
    List<Order> selectBuys(String username);
    PageInfo<Order> searchMyNeedsByKeys(Integer pageNum,String content,String username);
    int deleteByPrimaryKey(OrderDeleteParams params);

    PageInfo<Order> searchAllByKeys(String keys,Integer pageNum);
    int delOrderById(Integer id);

    /**
     * 分页查询所有货源
     * @return
     */
    PageInfo<Order> findAllGoods(Integer pageNum);

    /**
     * 关键词查询货源
     * @param keys
     * @param pageNum
     * @return
     */
    PageInfo<Order> searchGoodsByKeys(String keys, Integer pageNum);

    /**
     * 上架商品
     * @param id
     * @return
     */
    int takeUpDownOrder(Integer id,Integer status);

    /**
     * 获取商品详情界面的商品轮播图
     * database：tb_order_picture
     * @param id
     * @return
     */
    List<String> getOrderCarousel(Integer id);

    /**
     * 针对商品发表评论
     * @param orderDiscuss
     * @return
     */
    int leaveComments(OrderDiscuss orderDiscuss);

    /**
     * 给别人评论的时候，给别人的评论数量++
     * @param newNum
     * @return
     */
    int commentsNumAdd(String username,Integer newNum);
}
